const { ccclass, property } = cc._decorator;
import WinNodeBase from '../WinNodeBase';

@ccclass
export default class setingControl extends WinNodeBase {
    @property(cc.Slider)
    VolumeAJ: cc.Slider = null;
    @property(cc.Slider)
    VolumeYX: cc.Slider = null;
    @property(cc.Toggle)
    EnabledAJ: cc.Toggle = null;
    @property(cc.Toggle)
    EnabledYX: cc.Toggle = null;
    onLoad() {
        let date = gameHelper.getInstance().mySetParams;
        if (date?.length > 0) {
            this.VolumeAJ.progress = date[0].Volume;
            this.VolumeYX.progress = date[1].Volume;
            this.EnabledAJ.isChecked = date[0].Enabled;
            this.EnabledYX.isChecked = date[1].Enabled;
        }
        else {
            date.push({ Volume: 1, Enabled: false });
            date.push({ Volume: 1, Enabled: false });
            gameHelper.getInstance().mySetParams = date;
        }
    }
    onDisable() {
        let date = gameHelper.getInstance().mySetParams;
        date[0] = { Volume: this.VolumeAJ.progress, Enabled: this.EnabledAJ.isChecked };
        date[1] = { Volume: this.VolumeYX.progress, Enabled: this.EnabledYX.isChecked };
        gameHelper.getInstance().mySetParams = date;
    }
}
